let a = { name:'冯总'}
let b =  [1,2,3]  // new Array()

console.log(b instanceof Object);

console.log(instance_of(b,Object));
// b.__proto__ = b.prototype.prototype

function instance_of(left,right) {
    let leftVal = left.__proto__
    let rightVal = right.prototype


    while(true) 
    {
        if(leftVal === null) return flase
        if(leftVal === rightVal) return true
        leftVal = leftVal.__proto__
    }
    
}

function foo() {

}

console.log(instance_of(a, Object));
console.log(instance_of(b, Array));
console.log(instance_of(foo, Function));


// let a = {name: 'true'}
// let b = [1,2,3]
// let c = function() {}
// console.log(a instanceof Object); // true
// console.log(b instanceof Array); // true
// console.log(c instanceof Function); // true